// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "MissionStruct.h"
#include "SaveInfoStruct.generated.h"

USTRUCT(BlueprintType)
struct MISCELLANEOUSPROJECT_API FSavedMissionComponent
{
	GENERATED_USTRUCT_BODY()

	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	bool WasInMission;
	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	FMissionMaster LastMission;
	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	TArray<FName> DiscoveredLocations;
	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	TArray<FMissionMaster> AllMissions;
	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	TArray<FDefaultNPCInfo> DefaultNPCs;
	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	TArray<FDefaultNPCInfo> KnownNPCs;

};

USTRUCT(BlueprintType)
struct MISCELLANEOUSPROJECT_API FSavedPlayerLevel
{
	GENERATED_USTRUCT_BODY()

	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	int32 PlayerLevel;
	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	float CurrentXP;
	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	float TotalXP;
	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	float NeededXP;
	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	float NeededXPMultiplier;

	FSavedPlayerLevel() {
		PlayerLevel = 0;
		CurrentXP = 0.f;
		TotalXP = 0.f;
		NeededXP = 0.f;
		NeededXPMultiplier = 0.f;
	}

	FSavedPlayerLevel(const FSavedPlayerLevel& LSavedPlayerLevel) {
		PlayerLevel = LSavedPlayerLevel.PlayerLevel;
		CurrentXP = LSavedPlayerLevel.CurrentXP;
		TotalXP = LSavedPlayerLevel.TotalXP;
		NeededXP = LSavedPlayerLevel.NeededXP;
		NeededXPMultiplier = LSavedPlayerLevel.NeededXPMultiplier;
	}

	friend bool operator==(const FSavedPlayerLevel& Elem1, const FSavedPlayerLevel& Elem2);
};


USTRUCT(BlueprintType)
struct MISCELLANEOUSPROJECT_API FSavedPlayerInfo
{
	GENERATED_USTRUCT_BODY()

	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	FTransform PlayerTransform;
	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	FRotator ControlRotation;
	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	FSavedPlayerLevel PlayerLevel;

	FSavedPlayerInfo() {
		PlayerTransform = FTransform();
		ControlRotation = FRotator();
		PlayerLevel = FSavedPlayerLevel();
	}

	FSavedPlayerInfo(const FSavedPlayerInfo& LSavedPlayerInfo) {
		PlayerTransform = FTransform(LSavedPlayerInfo.PlayerTransform.GetRotation(), LSavedPlayerInfo.PlayerTransform.GetTranslation(), LSavedPlayerInfo.PlayerTransform.GetScale3D());
		ControlRotation = FRotator(LSavedPlayerInfo.ControlRotation.Pitch, LSavedPlayerInfo.ControlRotation.Yaw, LSavedPlayerInfo.ControlRotation.Roll);
		PlayerLevel = FSavedPlayerLevel(LSavedPlayerInfo.PlayerLevel);
	}
};

USTRUCT(BlueprintType)
struct MISCELLANEOUSPROJECT_API FSavedSlotInfo
{
	GENERATED_USTRUCT_BODY()

	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	FString SlotName;
	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	FDateTime DateTime;

	friend bool operator==(const FSavedSlotInfo& Elem1, const FSavedSlotInfo& Elem2);
};

FORCEINLINE bool operator==(const FSavedPlayerLevel& Elem1, const FSavedPlayerLevel& Elem2) {
	return Elem1.PlayerLevel == Elem2.PlayerLevel&&
		Elem1.CurrentXP == Elem2.CurrentXP&&
		Elem1.TotalXP == Elem2.TotalXP&&
		Elem1.NeededXP == Elem2.NeededXP&&
		Elem1.NeededXPMultiplier == Elem2.NeededXPMultiplier;
}

FORCEINLINE bool operator==(const FSavedSlotInfo& Elem1, const FSavedSlotInfo& Elem2) {
	return Elem1.SlotName == Elem2.SlotName&&Elem1.DateTime == Elem2.DateTime;
}

